cap prog drop xlstocsvdlg
prog define  xlstocsvdlg
	
	syntax, [file(string)     ///
			 dirc(string)  todir(string) FIRST]


if (`"`file'"'!=""&`"`dirc'"'!=""){

	di _n "note: dirc() is ignored as file() is specified"

}
	

if (`"`file'"'==""){
	if(`"`dirc'"'==""){
		di as error "either file() or dirc() should be specified"
		error 198
	}
	else{

		local file `dirc'
	}
}

if "`first'"!=""{
	local afirst ,first
	local first first
}

	// get the install file names of anything
	di _n(1) "{title:Executing the xlstocsv command}" _n
	if `"`todir'"'==""{
        di as txt `"xlstocsv `file' `afirst' "'   _n 
    }
    else{
        di as txt `"xlstocsv `file', todir(`todir') `first'"'   _n 
    }

	// call the dxls function  
	xlstocsv `"`file'"',todir(`"`todir'"') `first'    
	
end
